{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Calculus 微积分\n",
    "\n",
    "微积分相关方法。\n",
    "\n",
    "该模块实现了求解给定拉格朗日函数的欧拉-拉格朗日方程的方法。\n",
    "\n",
    "## sympy.calculus.euler.euler_equations(L, funcs=(), vars=())\n",
    "\n",
    "求给定拉格朗日函数的欧拉-拉格朗日方程[R26]。\n",
    "\n",
    "### Parameters 参数\n",
    "\n",
    "#### L : Expr\n",
    "\n",
    "拉格朗日函数应该是第二个论证中列出的函数及其导数的函数。\n",
    "\n",
    "例如，在两个函数 `𝑓(𝑥,𝑦), 𝑔(𝑥,𝑦)`和两个独立变量 `x`，`y` 的拉格朗日函数的形式是:\n",
    "\n",
    "$ L\\left(f(x,y),g(x,y),\\frac{\\partial f(x,y)}{\\partial x}, \\frac{\\partial f(x,y)}{\\partial y}, \\frac{\\partial g(x,y)}{\\partial x}, \\frac{\\partial g(x,y)}{\\partial y},x,y\\right) $\n",
    "\n",
    "在许多情况下，不需要提供任何东西，除了拉格朗日函数，它将被自动检测(如果不能这样做，将引发错误)。\n",
    "\n",
    "#### Funcs: 函数或函数的迭代\n",
    "\n",
    "拉格朗日函数所依赖的函数。欧拉方程是这些函数的微分方程。\n",
    "\n",
    "#### vars: 符号或可迭代的符号\n",
    "\n",
    "作为函数的独立变量的符号。\n",
    "\n",
    "### Returns 返回\n",
    "\n",
    "#### eqns : list of Eq\n",
    "\n",
    "方程列表\n",
    "\n",
    "微分方程列表，每个函数一个。\n",
    "\n",
    "### 例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Eq(-x(t) - Derivative(x(t), (t, 2)), 0)]\n",
      "[Eq(-Derivative(u(t, x), (t, 2)) + Derivative(u(t, x), (x, 2)), 0)]\n"
     ]
    }
   ],
   "source": [
    "from sympy import Symbol, Function\n",
    "from sympy.calculus.euler import euler_equations\n",
    "x = Function('x')\n",
    "t = Symbol('t')\n",
    "L = (x(t).diff(t))**2/2 - x(t)**2/2\n",
    "print(euler_equations(L, x(t), t))\n",
    "u = Function('u')\n",
    "x = Symbol('x')\n",
    "L = (u(t, x).diff(t))**2/2 - (u(t, x).diff(x))**2/2\n",
    "print(euler_equations(L, u(t, x), [t, x]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 参考资料\n",
    "\n",
    "R26(1,2) https://en.wikipedia.org/wiki/Euler%E2%80%93Lagrange_equation\n",
    "\n",
    "Singularities 奇点\n",
    "This module implements algorithms for finding singularities for a function and identifying types of functions.\n",
    "\n",
    "这个模块实现了为函数寻找奇点和识别函数类型的算法。\n",
    "\n",
    "The differential calculus methods in this module include methods to identify the following function types in the given Interval: - Increasing - Strictly Increasing - Decreasing - Strictly Decreasing - Monotonic\n",
    "\n",
    "本模块中的微分方法包括在给定区间内识别以下函数类型的方法:-递增-严格递增-严格递减-严格递减-单调\n",
    "\n",
    "sympy.calculus.singularities. 症状，计算，奇异性is_decreasing 正在减少(expression 表达式, interval=Reals区间 = 雷亚尔, symbol=None符号 = 无)\n",
    "Return whether the function is decreasing in the given interval.\n",
    "\n",
    "返回函数是否在给定的时间间隔内递减。\n",
    "\n",
    "Parameters 参数\n",
    "expression : Expr\n",
    "\n",
    "表达式: Expr\n",
    "\n",
    "The target function which is being checked.\n",
    "\n",
    "正在检查的目标函数。\n",
    "\n",
    "interval : Set, optional\n",
    "\n",
    "间隔: 设置，可选\n",
    "\n",
    "The range of values in which we are testing (defaults to set of all real numbers).\n",
    "\n",
    "我们测试的值的范围(默认设置所有实数)。\n",
    "\n",
    "symbol : Symbol, optional\n",
    "\n",
    "符号: 可选的符号\n",
    "\n",
    "The symbol present in expression which gets varied over the given range.\n",
    "\n",
    "表达式中出现的符号，在给定范围内变化。\n",
    "\n",
    "Returns 报税表\n",
    "Boolean\n",
    "\n",
    "布尔\n",
    "\n",
    "True if expression is decreasing (either strictly decreasing or constant) in the given interval, False otherwise.\n",
    "\n",
    "如果表达式在给定区间内递减(严格递减或常数) ，则为 True，否则为 False。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import is_decreasing\n",
    "from sympy.abc import x, y\n",
    "from sympy import S, Interval, oo\n",
    "is_decreasing(1/(x**2 - 3*x), Interval.open(1.5, 3))\n",
    "True\n",
    "is_decreasing(1/(x**2 - 3*x), Interval.Lopen(3, oo))\n",
    "True\n",
    "is_decreasing(1/(x**2 - 3*x), Interval.Ropen(-oo, S(3)/2))\n",
    "False\n",
    "is_decreasing(-x**2, Interval(-oo, 0))\n",
    "False\n",
    "is_decreasing(-x**2 + y, Interval(-oo, 0), x)\n",
    "False"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.singularities. 症状，计算，奇异性is_increasing 越来越多(expression 表达式, interval=Reals区间 = 雷亚尔, symbol=None符号 = 无)\n",
    "Return whether the function is increasing in the given interval.\n",
    "\n",
    "返回函数是否在给定的时间间隔内增加。\n",
    "\n",
    "Parameters 参数\n",
    "expression : Expr\n",
    "\n",
    "表达式: Expr\n",
    "\n",
    "The target function which is being checked.\n",
    "\n",
    "正在检查的目标函数。\n",
    "\n",
    "interval : Set, optional\n",
    "\n",
    "间隔: 设置，可选\n",
    "\n",
    "The range of values in which we are testing (defaults to set of all real numbers).\n",
    "\n",
    "我们测试的值的范围(默认设置所有实数)。\n",
    "\n",
    "symbol : Symbol, optional\n",
    "\n",
    "符号: 可选的符号\n",
    "\n",
    "The symbol present in expression which gets varied over the given range.\n",
    "\n",
    "表达式中出现的符号，在给定范围内变化。\n",
    "\n",
    "Returns 报税表\n",
    "Boolean\n",
    "\n",
    "布尔\n",
    "\n",
    "True if expression is increasing (either strictly increasing or constant) in the given interval, False otherwise.\n",
    "\n",
    "如果表达式在给定的时间间隔内增加(严格增加或常数) ，则为 True，否则为 False。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import is_increasing\n",
    "from sympy.abc import x, y\n",
    "from sympy import S, Interval, oo\n",
    "is_increasing(x**3 - 3*x**2 + 4*x, S.Reals)\n",
    "True\n",
    "is_increasing(-x**2, Interval(-oo, 0))\n",
    "True\n",
    "is_increasing(-x**2, Interval(0, oo))\n",
    "False\n",
    "is_increasing(4*x**3 - 6*x**2 - 72*x + 30, Interval(-2, 3))\n",
    "False\n",
    "is_increasing(x**2 + y, Interval(1, 2), x)\n",
    "True"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.singularities. 症状，计算，奇异性is_monotonic 是单调的(expression 表达式, interval=Reals区间 = 雷亚尔, symbol=None符号 = 无)\n",
    "Return whether the function is monotonic in the given interval.\n",
    "\n",
    "返回函数在给定区间内是否为单调函数。\n",
    "\n",
    "Parameters 参数\n",
    "expression : Expr\n",
    "\n",
    "表达式: Expr\n",
    "\n",
    "The target function which is being checked.\n",
    "\n",
    "正在检查的目标函数。\n",
    "\n",
    "interval : Set, optional\n",
    "\n",
    "间隔: 设置，可选\n",
    "\n",
    "The range of values in which we are testing (defaults to set of all real numbers).\n",
    "\n",
    "我们测试的值的范围(默认设置所有实数)。\n",
    "\n",
    "symbol : Symbol, optional\n",
    "\n",
    "符号: 可选的符号\n",
    "\n",
    "The symbol present in expression which gets varied over the given range.\n",
    "\n",
    "表达式中出现的符号，在给定范围内变化。\n",
    "\n",
    "Returns 报税表\n",
    "Boolean\n",
    "\n",
    "布尔\n",
    "\n",
    "True if expression is monotonic in the given interval, False otherwise.\n",
    "\n",
    "如果表达式在给定区间内是单调的，则为 True，否则为 False。\n",
    "\n",
    "Raises 加注\n",
    "NotImplementedError\n",
    "\n",
    "没有时间限制\n",
    "\n",
    "Monotonicity check has not been implemented for the queried function.\n",
    "\n",
    "没有为查询的函数实现单调性检查。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import is_monotonic\n",
    "from sympy.abc import x, y\n",
    "from sympy import S, Interval, oo\n",
    "is_monotonic(1/(x**2 - 3*x), Interval.open(1.5, 3))\n",
    "True\n",
    "is_monotonic(1/(x**2 - 3*x), Interval.Lopen(3, oo))\n",
    "True\n",
    "is_monotonic(x**3 - 3*x**2 + 4*x, S.Reals)\n",
    "True\n",
    "is_monotonic(-x**2, S.Reals)\n",
    "False\n",
    "is_monotonic(x**2 + y + 1, Interval(1, 2), x)\n",
    "True"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.singularities. 症状，计算，奇异性is_strictly_decreasing 是严格减少的(expression 表达式, interval=Reals区间 = 雷亚尔, symbol=None符号 = 无)\n",
    "Return whether the function is strictly decreasing in the given interval.\n",
    "\n",
    "返回函数是否在给定区间内严格递减。\n",
    "\n",
    "Parameters 参数\n",
    "expression : Expr\n",
    "\n",
    "表达式: Expr\n",
    "\n",
    "The target function which is being checked.\n",
    "\n",
    "正在检查的目标函数。\n",
    "\n",
    "interval : Set, optional\n",
    "\n",
    "间隔: 设置，可选\n",
    "\n",
    "The range of values in which we are testing (defaults to set of all real numbers).\n",
    "\n",
    "我们测试的值的范围(默认设置所有实数)。\n",
    "\n",
    "symbol : Symbol, optional\n",
    "\n",
    "符号: 可选的符号\n",
    "\n",
    "The symbol present in expression which gets varied over the given range.\n",
    "\n",
    "表达式中出现的符号，在给定范围内变化。\n",
    "\n",
    "Returns 报税表\n",
    "Boolean\n",
    "\n",
    "布尔\n",
    "\n",
    "True if expression is strictly decreasing in the given interval, False otherwise.\n",
    "\n",
    "如果表达式在给定时间间隔内严格减小，则为 True，否则为 False。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import is_strictly_decreasing\n",
    "from sympy.abc import x, y\n",
    "from sympy import S, Interval, oo\n",
    "is_strictly_decreasing(1/(x**2 - 3*x), Interval.Lopen(3, oo))\n",
    "True\n",
    "is_strictly_decreasing(1/(x**2 - 3*x), Interval.Ropen(-oo, S(3)/2))\n",
    "False\n",
    "is_strictly_decreasing(-x**2, Interval(-oo, 0))\n",
    "False\n",
    "is_strictly_decreasing(-x**2 + y, Interval(-oo, 0), x)\n",
    "False"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.singularities. 症状，计算，奇异性is_strictly_increasing 正在严格地增加(expression 表达式, interval=Reals区间 = 雷亚尔, symbol=None符号 = 无)\n",
    "Return whether the function is strictly increasing in the given interval.\n",
    "\n",
    "返回函数是否在给定区间内严格增长。\n",
    "\n",
    "Parameters 参数\n",
    "expression : Expr\n",
    "\n",
    "表达式: Expr\n",
    "\n",
    "The target function which is being checked.\n",
    "\n",
    "正在检查的目标函数。\n",
    "\n",
    "interval : Set, optional\n",
    "\n",
    "间隔: 设置，可选\n",
    "\n",
    "The range of values in which we are testing (defaults to set of all real numbers).\n",
    "\n",
    "我们测试的值的范围(默认设置所有实数)。\n",
    "\n",
    "symbol : Symbol, optional\n",
    "\n",
    "符号: 可选的符号\n",
    "\n",
    "The symbol present in expression which gets varied over the given range.\n",
    "\n",
    "表达式中出现的符号，在给定范围内变化。\n",
    "\n",
    "Returns 报税表\n",
    "Boolean\n",
    "\n",
    "布尔\n",
    "\n",
    "True if expression is strictly increasing in the given interval, False otherwise.\n",
    "\n",
    "如果表达式在给定的时间间隔内严格递增，则为 True，否则为 False。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import is_strictly_increasing\n",
    "from sympy.abc import x, y\n",
    "from sympy import Interval, oo\n",
    "is_strictly_increasing(4*x**3 - 6*x**2 - 72*x + 30, Interval.Ropen(-oo, -2))\n",
    "True\n",
    "is_strictly_increasing(4*x**3 - 6*x**2 - 72*x + 30, Interval.Lopen(3, oo))\n",
    "True\n",
    "is_strictly_increasing(4*x**3 - 6*x**2 - 72*x + 30, Interval.open(-2, 3))\n",
    "False\n",
    "is_strictly_increasing(-x**2, Interval(0, oo))\n",
    "False\n",
    "is_strictly_increasing(-x**2 + y, Interval(-oo, 0), x)\n",
    "False"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.singularities. 症状，计算，奇异性monotonicity_helper 辅助单调性(expression 表达式, predicate 谓词, interval=Reals区间 = 雷亚尔, symbol=None符号 = 无)\n",
    "Helper function for functions checking function monotonicity.\n",
    "\n",
    "函数检查函数单调性的辅助函数。\n",
    "\n",
    "Parameters 参数\n",
    "expression : Expr\n",
    "\n",
    "表达式: Expr\n",
    "\n",
    "The target function which is being checked\n",
    "\n",
    "正在检查的目标函数\n",
    "\n",
    "predicate : function\n",
    "\n",
    "断言: 函数\n",
    "\n",
    "The property being tested for. The function takes in an integer and returns a boolean. The integer input is the derivative and the boolean result should be true if the property is being held, and false otherwise.\n",
    "\n",
    "正在进行测试的物业。该函数接受一个整数并返回一个布尔值。整数输入是导数，如果属性被保存，布尔结果应为 true，否则为 false。\n",
    "\n",
    "interval : Set, optional\n",
    "\n",
    "间隔: 设置，可选\n",
    "\n",
    "The range of values in which we are testing, defaults to all reals.\n",
    "\n",
    "我们测试的值的范围，默认为所有雷亚尔。\n",
    "\n",
    "symbol : Symbol, optional\n",
    "\n",
    "符号: 可选的符号\n",
    "\n",
    "The symbol present in expression which gets varied over the given range.\n",
    "\n",
    "表达式中出现的符号，在给定范围内变化。\n",
    "\n",
    "It returns a boolean indicating whether the interval in which\n",
    "\n",
    "它返回一个布尔值，该布尔值指示\n",
    "\n",
    "the function’s derivative satisfies given predicate is a superset\n",
    "\n",
    "函数的导数满足给定的谓词是超集\n",
    "\n",
    "of the given interval.\n",
    "\n",
    "在给定的时间间隔。\n",
    "\n",
    "Returns 报税表\n",
    "Boolean\n",
    "\n",
    "布尔\n",
    "\n",
    "True if predicate is true for all the derivatives when symbol is varied in range, False otherwise.\n",
    "\n",
    "如果当符号在范围内变化时，对于所有的导数，谓词为 True，则为 True，否则为 False。\n",
    "\n",
    "sympy.calculus.singularities. 症状，计算，奇异性singularities 奇点(expression 表达式, symbol 符号, domain=None0.0)\n",
    "Find singularities of a given function.\n",
    "\n",
    "求一个给定函数的奇点。\n",
    "\n",
    "Parameters 参数\n",
    "expression : Expr\n",
    "\n",
    "表达式: Expr\n",
    "\n",
    "The target function in which singularities need to be found.\n",
    "\n",
    "需要找到奇点的目标函数。\n",
    "\n",
    "symbol : Symbol\n",
    "\n",
    "符号: 符号\n",
    "\n",
    "The symbol over the values of which the singularity in expression in being searched for.\n",
    "\n",
    "符号在其值上的符号，在表达式中寻找奇点。\n",
    "\n",
    "Returns 报税表\n",
    "Set\n",
    "\n",
    "预备\n",
    "\n",
    "A set of values for symbol for which expression has a singularity. An EmptySet is returned if expression has no singularities for any given value of Symbol.\n",
    "\n",
    "一组表达式具有奇点的符号值。如果表达式对任何给定的 Symbol 值没有奇点，则返回 EmptySet。\n",
    "\n",
    "Raises 加注\n",
    "NotImplementedError\n",
    "\n",
    "没有时间限制\n",
    "\n",
    "Methods for determining the singularities of this function have not been developed.\n",
    "\n",
    "确定这个函数的奇异性的方法还没有发展。\n",
    "\n",
    "Notes\n",
    "\n",
    "注释\n",
    "\n",
    "This function does not find non-isolated singularities nor does it find branch points of the expression.\n",
    "\n",
    "这个函数没有找到非孤立的奇点，也没有找到表达式的分支点。\n",
    "\n",
    "Currently supported functions are: 目前支持的职能有:\n",
    "univariate continuous (real or complex) functions\n",
    "\n",
    "单变量连续(实数或复数)函数\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.calculus.singularities import singularities\n",
    "from sympy import Symbol, log\n",
    "x = Symbol('x', real=True)\n",
    "y = Symbol('y', real=False)\n",
    "singularities(x**2 + x + 1, x)\n",
    "EmptySet\n",
    "singularities(1/(x + 1), x)\n",
    "{-1}\n",
    "singularities(1/(y**2 + 1), y)\n",
    "{-I, I}\n",
    "singularities(1/(y**3 + 1), y)\n",
    "{-1, 1/2 - sqrt(3)*I/2, 1/2 + sqrt(3)*I/2}\n",
    "singularities(log(x), x)\n",
    "{0}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "References\n",
    "\n",
    "参考资料\n",
    "\n",
    "R27\n",
    "https://en.wikipedia.org/wiki/Mathematical_singularity\n",
    "\n",
    "Finite difference weights 差分\n",
    "This module implements an algorithm for efficient generation of finite difference weights for ordinary differentials of functions for derivatives from 0 (interpolation) up to arbitrary order.\n",
    "\n",
    "这个模块实现了一个算法，可以有效地生成从0(插值)到任意阶导数的函数的普通微分的差分。\n",
    "\n",
    "The core algorithm is provided in the finite difference weight generating function (finite_diff_weights), and two convenience functions are provided for:\n",
    "\n",
    "核心算法提供了差分权重母函数(finite _ diff _ weights) ，并提供了两个方便函数:\n",
    "\n",
    "estimating a derivative (or interpolate) directly from a series of points\n",
    "直接从一系列点估计导数(或插值)\n",
    "is also provided (apply_finite_diff).\n",
    "\n",
    "也提供了(apply _ finite _ diff)。\n",
    "\n",
    "differentiating by using finite difference approximations\n",
    "用差分近似法进行差分\n",
    "(differentiate_finite).\n",
    "\n",
    "(差分 _ 有限)。\n",
    "\n",
    "sympy.calculus.finite_diff. 症状，结石，有限的差异apply_finite_diff 应用/finite/diff(order 秩序, x_list 列表, y_list Y _ list, x0=0)\n",
    "Calculates the finite difference approximation of the derivative of requested order at x0 from points provided in x_list and y_list.\n",
    "\n",
    "从 x 列表和 y 列表中提供的点计算请求次序的导数的差分近似值。\n",
    "\n",
    "Parameters 参数\n",
    "order: int\n",
    "\n",
    "命令: int\n",
    "\n",
    "order of derivative to approximate. 0 corresponds to interpolation.\n",
    "\n",
    "导数的次序大约0对应于插值。\n",
    "\n",
    "x_list: sequence\n",
    "\n",
    "列表: sequence\n",
    "\n",
    "Sequence of (unique) values for the independent variable.\n",
    "\n",
    "独立变量的(唯一的)值序列。\n",
    "\n",
    "y_list: sequence\n",
    "\n",
    "顺序\n",
    "\n",
    "The function value at corresponding values for the independent variable in x_list.\n",
    "\n",
    "X_ 列表中的自变量在相应值处的函数值。\n",
    "\n",
    "x0: Number or Symbol\n",
    "\n",
    "X0: 数字或符号\n",
    "\n",
    "At what value of the independent variable the derivative should be evaluated. Defaults to 0.\n",
    "\n",
    "在什么值的自变量的导数应计算。默认值为0。\n",
    "\n",
    "Returns 报税表\n",
    "sympy.core.add.Add or sympy.core.numbers.Number\n",
    "\n",
    "添加或 sympy.core.numbers. Number\n",
    "\n",
    "The finite difference expression approximating the requested derivative order at x0.\n",
    "\n",
    "差分表达式近似于所请求的导数阶为 x 0。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.calculus import apply_finite_diff\n",
    "cube = lambda arg: (1.0*arg)**3\n",
    "xlist = range(-3,3+1)\n",
    "apply_finite_diff(2, xlist, map(cube, xlist), 2) - 12 \n",
    "-3.55271367880050e-15"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "we see that the example above only contain rounding errors. apply_finite_diff can also be used on more abstract objects:\n",
    "\n",
    "我们看到上面的例子只包含舍入误差. apply _ finite _ diff 也可以用在更抽象的对象上:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import IndexedBase, Idx\n",
    "from sympy.calculus import apply_finite_diff\n",
    "x, y = map(IndexedBase, 'xy')\n",
    "i = Idx('i')\n",
    "x_list, y_list = zip(*[(x[i+j], y[i+j]) for j in range(-1,2)])\n",
    "apply_finite_diff(1, x_list, y_list, x[i])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Notes\n",
    "\n",
    "注释\n",
    "\n",
    "Order = 0 corresponds to interpolation. Only supply so many points you think makes sense to around x0 when extracting the derivative (the function need to be well behaved within that region). Also beware of Runge’s phenomenon.\n",
    "\n",
    "阶数 = 0对应于插值。在提取导数时，只提供那么多你认为对 x0左右有意义的点(函数需要在该区域内表现良好)。同时也要注意朗格现象。\n",
    "\n",
    "See also参见 sympy.calculus.finite_diff.finite_diff_weights\n",
    "有限的，有限的，有限的，有限的\n",
    "\n",
    "References\n",
    "\n",
    "参考资料\n",
    "\n",
    "Fortran 90 implementation with Python interface for numerics: finitediff\n",
    "\n",
    "用 Python 接口实现 Fortran 90的数字运算: finitediff\n",
    "\n",
    "sympy.calculus.finite_diff. 症状，结石，有限的差异as_finite_diff 作为有限的差异(derivative 导数, points 点=1, x0=None0 = None, wrt=None没有)\n",
    "Deprecated function. Use Diff.as_finite_difference instead.\n",
    "\n",
    "不推荐使用函数. 改用 diff.as_ 有限差分。\n",
    "\n",
    "sympy.calculus.finite_diff. 症状，结石，有限的差异differentiate_finite 导数有限(expr 爆炸, *symbols 符号, points 点=1, x0=None0 = None, wrt=None没有, evaluate=False评估 = False)\n",
    "Differentiate expr and replace Derivatives with finite differences.\n",
    "\n",
    "用有限差分求导和代替导数。\n",
    "\n",
    "Parameters 参数\n",
    "expr : expression\n",
    "\n",
    "表达式\n",
    "\n",
    "*symbols : differentiate with respect to symbols\n",
    "\n",
    "* 符号: 根据符号加以区分\n",
    "\n",
    "points: sequence, coefficient or undefined function, optional\n",
    "\n",
    "点: 顺序，系数或未定义的函数，可选\n",
    "\n",
    "see Derivative.as_finite_difference\n",
    "\n",
    "参见派生.as _ finite _ difference\n",
    "\n",
    "x0: number or Symbol, optional\n",
    "\n",
    "0: number 或 Symbol，可选\n",
    "\n",
    "see Derivative.as_finite_difference\n",
    "\n",
    "参见派生.as _ finite _ difference\n",
    "\n",
    "wrt: Symbol, optional\n",
    "\n",
    "Wrt: 符号，可选\n",
    "\n",
    "see Derivative.as_finite_difference\n",
    "\n",
    "参见派生.as _ finite _ difference\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import sin, Function, differentiate_finite\n",
    "from sympy.abc import x, y, h\n",
    "f, g = Function('f'), Function('g')\n",
    "differentiate_finite(f(x)*g(x), x, points=[x-h, x+h])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "differentiate_finite works on any expression, including the expressions with embedded derivatives:\n",
    "\n",
    "对任何表达式，包括含有嵌入导数的表达式进行区分:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "differentiate_finite(f(x) + sin(x), x, 2)\n",
    "differentiate_finite(f(x, y), x, y)\n",
    "differentiate_finite(f(x)*g(x).diff(x), x)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To make finite difference with non-constant discretization step use undefined functions:\n",
    "\n",
    "使用非常数离散化步骤的差分使用未定义的函数:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "dx = Function('dx')\n",
    "differentiate_finite(f(x)*g(x).diff(x), points=dx(x))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.finite_diff. 症状，结石，有限的差异finite_diff_weights 有限差分重量(order 秩序, x_list 列表, x0=1)\n",
    "Calculates the finite difference weights for an arbitrarily spaced one-dimensional grid (x_list) for derivatives at x0 of order 0, 1, …, up to order using a recursive formula. Order of accuracy is at least len(x_list) - order, if x_list is defined correctly.\n",
    "\n",
    "使用递归公式计算任意间隔的一维网格(x _ 列表)中0阶、1阶、 ... 阶导数的差分权重。如果正确定义了 x_ 列表，则精度的顺序至少为 len (x_ 列表)顺序。\n",
    "\n",
    "Parameters 参数\n",
    "order: int\n",
    "\n",
    "命令: int\n",
    "\n",
    "Up to what derivative order weights should be calculated. 0 corresponds to interpolation.\n",
    "\n",
    "最多要计算多少导数的次序权重。0对应于插值。\n",
    "\n",
    "x_list: sequence\n",
    "\n",
    "列表: sequence\n",
    "\n",
    "Sequence of (unique) values for the independent variable. It is useful (but not necessary) to order x_list from nearest to furthest from x0; see examples below.\n",
    "\n",
    "独立变量的(唯一的)值序列。将 x _ list 从最近的到最远的列表排序是有用的(但不是必要的) ; 请参见下面的示例。\n",
    "\n",
    "x0: Number or Symbol\n",
    "\n",
    "X0: 数字或符号\n",
    "\n",
    "Root or value of the independent variable for which the finite difference weights should be generated. Default is S.One.\n",
    "\n",
    "自变量的根或值，为其生成差分权重，默认值为 S.One。\n",
    "\n",
    "Returns 报税表\n",
    "list\n",
    "\n",
    "名单\n",
    "\n",
    "A list of sublists, each corresponding to coefficients for increasing derivative order, and each containing lists of coefficients for increasing subsets of x_list.\n",
    "\n",
    "一个子表列表，每个子表对应于递增导数阶的系数，每个子表包含递增子表的系数列表。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import S\n",
    "from sympy.calculus import finite_diff_weights\n",
    "res = finite_diff_weights(1, [-S(1)/2, S(1)/2, S(3)/2, S(5)/2], 0)\n",
    "res"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Each sublist contains the most accurate formula at the end. Note, that in the above example res[1][1] is the same as res[1][2]. Since res[1][2] has an order of accuracy of len(x_list[:3]) - order = 3 - 1 = 2, the same is true for res[1][1]!\n",
    "\n",
    "每个子列表的末尾都包含最精确的公式。注意，在上面的例子中 res [1][1]与 res [1][2]相同。因为 res [1][2]有一个 len (x _ list [ : 3])-order = 3-1 = 2的准确性顺序，所以 res [1][1]也是如此！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import S\n",
    "from sympy.calculus import finite_diff_weights\n",
    "res = finite_diff_weights(1, [S(0), S(1), -S(1), S(2), -S(2)], 0)[1]\n",
    "res\n",
    "res[0]  # no approximation possible, using x_list[0] only\n",
    "res[1]  # classic forward step approximation\n",
    "res[2]  # classic centered approximation\n",
    "res[3:]  # higher order approximations"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let us compare this to a differently defined x_list. Pay attention to foo[i][k] corresponding to the gridpoint defined by x_list[k].\n",
    "\n",
    "让我们把它和一个不同定义的 x _ 列表进行比较，注意与 x _ list [ k ]定义的 gridpoint 对应的 foo [ i ][ k ]。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import S\n",
    "from sympy.calculus import finite_diff_weights\n",
    "foo = finite_diff_weights(1, [-S(2), -S(1), S(0), S(1), S(2)], 0)[1]\n",
    "foo\n",
    "foo[1]  # not the same and of lower accuracy as res[1]!\n",
    "foo[2]  # classic double backward step approximation\n",
    "foo[4]  # the same as res[4]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note that, unless you plan on using approximations based on subsets of x_list, the order of gridpoints does not matter.\n",
    "\n",
    "请注意，除非您计划使用基于 x _ 列表子集的近似值，否则网格点的顺序并不重要。\n",
    "\n",
    "The capability to generate weights at arbitrary points can be used e.g. to minimize Runge’s phenomenon by using Chebyshev nodes:\n",
    "\n",
    "在任意点生成权重的能力可以用于例如通过使用切比雪夫节点来最小化 Runge 现象:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import cos, symbols, pi, simplify\n",
    "from sympy.calculus import finite_diff_weights\n",
    "N, (h, x) = 4, symbols('h x')\n",
    "x_list = [x+h*cos(i*pi/(N)) for i in range(N,-1,-1)] # chebyshev nodes\n",
    "print(x_list)\n",
    "mycoeffs = finite_diff_weights(1, x_list, 0)[1][4]\n",
    "[simplify(c) for c in  mycoeffs] "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Notes\n",
    "\n",
    "注释\n",
    "\n",
    "If weights for a finite difference approximation of 3rd order derivative is wanted, weights for 0th, 1st and 2nd order are calculated “for free”, so are formulae using subsets of x_list. This is something one can take advantage of to save computational cost. Be aware that one should define x_list from nearest to furthest from x0. If not, subsets of x_list will yield poorer approximations, which might not grand an order of accuracy of len(x_list) - order.\n",
    "\n",
    "如果需要三阶导数的差分近似值的权值，则可以“免费”计算0阶、1阶和2阶的权值，使用 x _ 列表子集的公式也是如此。这是一个可以利用的东西，以节省计算成本。请注意，应该从距离 x0最近到最远的位置来定义 x _ list。如果不是，那么 x_ 列表的子集将产生较差的近似值，这可能不会提高 len (x_ 列表)顺序的准确性。\n",
    "\n",
    "See also参见 sympy.calculus.finite_diff.apply_finite_diff\n",
    "如果你是一个有限的人，那么你就是一个有限的人\n",
    "\n",
    "References\n",
    "\n",
    "参考资料\n",
    "\n",
    "R28\n",
    "Generation of Finite Difference Formulas on Arbitrarily Spaced Grids, Bengt Fornberg; Mathematics of computation; 51; 184; (1988); 699-706; doi:10.1090/S0025-5718-1988-0935077-0\n",
    "\n",
    "在任意间隔的网格上生成差分公式，Bengt Fornberg; 计算数学; 51; 184; (1988) ; 699-706; doi: 10.1090/S0025-5718-1988-0935077-0\n",
    "\n",
    "sympy.calculus.util. 症状，结石，尿毒症AccumBounds 累积范围\n",
    "alias of sympy.calculus.util.AccumulationBounds\n",
    "\n",
    "症状的别名 calculus.util.cumulationbounds\n",
    "\n",
    "class 类 sympy.calculus.util. 症状，结石，尿毒症AccumulationBounds 累积上限(min 分钟, max 麦克斯)\n",
    "# Note AccumulationBounds has an alias: AccumBounds\n",
    "\n",
    "# 注意堆积边界有一个别名: 堆积边界\n",
    "\n",
    "AccumulationBounds represent an interval [𝑎,𝑏], which is always closed at the ends. Here 𝑎 and 𝑏 can be any value from extended real numbers.\n",
    "\n",
    "累积界限表示一个区间[ a，b ][ a，b ] ，它总是在结束处关闭。这里 a 和 b 可以是扩展实数的任意值。\n",
    "\n",
    "The intended meaning of AccummulationBounds is to give an approximate location of the accumulation points of a real function at a limit point.\n",
    "\n",
    "累积界限的目的是给出一个实际函数在极限点上的累积点的近似位置。\n",
    "\n",
    "Let 𝑎 and 𝑏 be reals such that a <= b.\n",
    "\n",
    "设 a 和 b 是真实的 a < = b。\n",
    "\n",
    "⟨𝑎,𝑏⟩={𝑥∈ℝ∣𝑎≤𝑥≤𝑏}\n",
    "\n",
    "Something a，b something = { x ∈ r | a ≤ x ≤ b } something a，b something = { x ∈ r | a ≤ x ≤ b }\n",
    "\n",
    "⟨−∞,𝑏⟩={𝑥∈ℝ∣𝑥≤𝑏}∪{−∞,∞}\n",
    "\n",
    "Something-∞ ，b something = { x ∈ r 节点 x ≤ b }∪{-∞ ，∞} something ∞ ，b something = { x ∈ r 节点 x ≤ b }∪{-∞ ，∞}\n",
    "\n",
    "⟨𝑎,∞⟩={𝑥∈ℝ∣𝑎≤𝑥}∪{−∞,∞}\n",
    "\n",
    "Something a，∞ something = { x ∈ r 节点 a ≤ x }∪{-∞ ，∞} a，∞ something = { x ∈ r 节点 a ≤ x }∪{-∞ ，∞}\n",
    "\n",
    "⟨−∞,∞⟩=ℝ∪{−∞,∞}\n",
    "\n",
    "Something ∞ ，∞ something = r ∪{-∞ ，∞} something-∞ ，∞ something = r ∪{-∞ ，∞}\n",
    "\n",
    "𝑜𝑜 and −𝑜𝑜 are added to the second and third definition respectively, since if either −𝑜𝑜 or 𝑜𝑜 is an argument, then the other one should be included (though not as an end point). This is forced, since we have, for example, 1/𝐴𝑐𝑐𝑢𝑚𝐵𝑜𝑢𝑛𝑑𝑠(0,1)=𝐴𝑐𝑐𝑢𝑚𝐵𝑜𝑢𝑛𝑑𝑠(1,𝑜𝑜), and the limit at 0 is not one-sided. As x tends to 0−, then 1/𝑥−>−𝑜𝑜, so −𝑜𝑜 should be interpreted as belonging to 𝐴𝑐𝑐𝑢𝑚𝐵𝑜𝑢𝑛𝑑𝑠(1,𝑜𝑜) though it need not appear explicitly.\n",
    "\n",
    "是这样的\n",
    "及\n",
    "哦\n",
    "哦\n",
    "分别添加到第二个和第三个定义，因为如果\n",
    "哦\n",
    "哦\n",
    "或\n",
    "是的\n",
    "是的\n",
    "是一个论点，那么应该包括另一个(尽管不是作为一个终点)。这是被迫的，因为我们有，比如说,\n",
    "1/AccumBounds (0,1) = AccumBounds (1，oo)\n",
    "1/AccumBounds (0,1) = AccumBounds (1，oo)\n",
    "，以及\n",
    "0\n",
    "0\n",
    "并不是单边的，正如 x 倾向于\n",
    "0 -\n",
    "0 -\n",
    "那么\n",
    "1/x->-oo\n",
    "1/x->-oo\n",
    "，所以\n",
    "哦\n",
    "哦\n",
    "应该被解释为属于\n",
    "AccumBounds (1，oo)\n",
    "AccumBounds (1，oo)\n",
    "虽然它不需要明确地出现。\n",
    "\n",
    "In many cases it suffices to know that the limit set is bounded. However, in some other cases more exact information could be useful. For example, all accumulation values of cos(x) + 1 are non-negative. (AccumBounds(-1, 1) + 1 = AccumBounds(0, 2))\n",
    "\n",
    "在许多情况下，知道极限集是有界的就足够了。然而，在其他一些情况下，更精确的信息可能是有用的。例如，cos (x) + 1的所有累加值都是非负的。(AccumBounds (- 1,1) + 1 = AccumBounds (0,2))\n",
    "\n",
    "A AccumulationBounds object is defined to be real AccumulationBounds, if its end points are finite reals.\n",
    "\n",
    "如果累积边界对象的端点是有限的，则该对象被定义为真正的累积边界。\n",
    "\n",
    "Let 𝑋, 𝑌 be real AccumulationBounds, then their sum, difference, product are defined to be the following sets:\n",
    "\n",
    "让 x\n",
    "X\n",
    ",\n",
    "y\n",
    "Y\n",
    "如果它们是真正的累积边界，那么它们的和、差、积被定义为以下集合:\n",
    "\n",
    "𝑋+𝑌={𝑥+𝑦∣𝑥∈𝑋∩𝑦∈𝑌}\n",
    "\n",
    "X + y = { x + y 节点 x ∈ x ∩ y ∈ y } x + y = { x + y 节点 x ∈ x ∩ y ∈ y }\n",
    "\n",
    "𝑋−𝑌={𝑥−𝑦∣𝑥∈𝑋∩𝑦∈𝑌}\n",
    "\n",
    "X-y = { x-y 节点 x ∈ x ∩ y ∈ y } x-y = { x-y 节点 x ∈ x ∩ y ∈ y }\n",
    "\n",
    "𝑋∗𝑌={𝑥∗𝑦∣𝑥∈𝑋∩𝑦∈𝑌}\n",
    "\n",
    "X * y = { x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x = x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x\n",
    "\n",
    "When an AccumBounds is raised to a negative power, if 0 is contained between the bounds then an infinite range is returned, otherwise if an endpoint is 0 then a semi-infinite range with consistent sign will be returned.\n",
    "\n",
    "当 AccumBounds 被提高到负幂时，如果0包含在边界之间，则返回无限范围，否则，如果端点为0，则返回具有一致符号的半无限范围。\n",
    "\n",
    "AccumBounds in expressions behave a lot like Intervals but the semantics are not necessarily the same. Division (or exponentiation to a negative integer power) could be handled with intervals by returning a union of the results obtained after splitting the bounds between negatives and positives, but that is not done with AccumBounds. In addition, bounds are assumed to be independent of each other; if the same bound is used in more than one place in an expression, the result may not be the supremum or infimum of the expression (see below). Finally, when a boundary is 1, exponentiation to the power of oo yields oo, neither 1 nor nan.\n",
    "\n",
    "表达式中的 AccumBounds 的行为与 interval 很相似，但语义不一定相同。除法(或求幂为负整数的幂)可以通过返回在分裂负值和正值之间的界限后获得的结果的并来处理，但是不能通过累积界限来完成。此外，界被假定为彼此独立的; 如果同一界在一个表达式的多个地方使用，结果可能不是表达式的上确界或下确界(见下文)。最后，当边界为1时，对 oo 的幂求幂得到 oo，既不是1也不是 nan。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import AccumBounds, sin, exp, log, pi, E, S, oo\n",
    "from sympy.abc import x\n",
    "AccumBounds(0, 1) + AccumBounds(1, 2)\n",
    "AccumBounds(0, 1) - AccumBounds(0, 2)\n",
    "AccumBounds(-2, 3)*AccumBounds(-1, 1)\n",
    "AccumBounds(1, 2)*AccumBounds(3, 5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The exponentiation of AccumulationBounds is defined as follows:\n",
    "\n",
    "累积边界的求幂定义如下:\n",
    "\n",
    "If 0 does not belong to 𝑋 or 𝑛>0 then\n",
    "\n",
    "如果0不属于 x x 或 n > 0 n > 0，那么\n",
    "\n",
    "𝑋𝑛={𝑥𝑛∣𝑥∈𝑋}\n",
    "\n",
    "X n\n",
    "={\n",
    "X\n",
    "N\n",
    "函数 x ∈ x }\n",
    "Xn = { Xn 之节点 x ∈ x }\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "AccumBounds(1, 4)**(S(1)/2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "otherwise, an infinite or semi-infinite result is obtained:\n",
    "\n",
    "否则，得到一个无限或半无限的结果:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "1/AccumBounds(-1, 1)\n",
    "AccumBounds(-oo, oo)\n",
    "1/AccumBounds(0, 2)\n",
    "AccumBounds(1/2, oo)\n",
    "1/AccumBounds(-oo, 0)\n",
    "AccumBounds(-oo, 0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A boundary of 1 will always generate all nonnegatives:\n",
    "\n",
    "1的边界总是会生成所有的非负数:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "AccumBounds(1, 2)**oo\n",
    "AccumBounds(0, 1)**oo"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If the exponent is itself an AccumulationBounds or is not an integer then unevaluated results will be returned unless the base values are positive:\n",
    "\n",
    "如果指数本身是累积界限或者不是整数，那么未计算的结果将被返回，除非基值是正数:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "AccumBounds(2, 3)**AccumBounds(-1, 2)\n",
    "AccumBounds(-2, 3)**AccumBounds(-1, 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "AccumBounds(-2, -1)**(S(1)/2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note: <𝑎,𝑏>2 is not same as <𝑎,𝑏>∗<𝑎,𝑏>\n",
    "\n",
    "注: < a，b\n",
    ">\n",
    "图2\n",
    "< a，b > 2\n",
    "并不等同于\n",
    "< a，b > 第一次/第一次/第一次\n",
    "< a，b > 第一次/第一次/第一次"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "AccumBounds(-1, 1)**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "AccumBounds(1, 3) < 4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "AccumBounds(1, 3) < -1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Some elementary functions can also take AccumulationBounds as input. A function 𝑓 evaluated for some real AccumulationBounds <𝑎,𝑏> is defined as 𝑓(⟨𝑎,𝑏⟩)={𝑓(𝑥)∣𝑎≤𝑥≤𝑏}\n",
    "\n",
    "一些初等函数也可以采用累积边界作为输入\n",
    "F\n",
    "对一些实际的累积边界进行评估\n",
    "< a，b >\n",
    "< a，b >\n",
    "定义为\n",
    "F (something a，b something) = { f (x)节点 a ≤ x ≤ b }\n",
    "F (something a，b something) = { f (x)节点 a ≤ x ≤ b }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "sin(AccumBounds(pi/6, pi/3))\n",
    "AccumBounds(1/2, sqrt(3)/2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "exp(AccumBounds(0, 1))\n",
    "AccumBounds(1, E)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "log(AccumBounds(1, E))\n",
    "AccumBounds(0, 1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Some symbol in an expression can be substituted for a AccumulationBounds object. But it doesn’t necessarily evaluate the AccumulationBounds for that expression.\n",
    "\n",
    "表达式中的某些符号可以替换累积边界对象。但是它不一定计算该表达式的累积边界。\n",
    "\n",
    "The same expression can be evaluated to different values depending upon the form it is used for substitution since each instance of an AccumulationBounds is considered independent. For example:\n",
    "\n",
    "由于累积边界的每个实例都被认为是独立的，因此可以根据用于替换的形式对相同的表达式计算不同的值。例如:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "(x**2 + 2*x + 1).subs(x, AccumBounds(-1, 1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "((x + 1)**2).subs(x, AccumBounds(-1, 1))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Notes\n",
    "\n",
    "注释\n",
    "\n",
    "Do not use AccumulationBounds for floating point interval arithmetic calculations, use mpmath.iv instead.\n",
    "\n",
    "不要对浮点间隔算术计算使用累积边界，而是使用 mpmath.iv。\n",
    "\n",
    "References\n",
    "\n",
    "参考资料\n",
    "\n",
    "R29\n",
    "https://en.wikipedia.org/wiki/Interval_arithmetic\n",
    "\n",
    "R30\n",
    "http://fab.cba.mit.edu/classes/S62.12/docs/Hickey_interval.pdf\n",
    "\n",
    "property 财产 delta 三角洲\n",
    "Returns the difference of maximum possible value attained by AccumulationBounds object and minimum possible value attained by AccumulationBounds object.\n",
    "\n",
    "返回累积边界对象获得的最大可能值与累积边界对象获得的最小可能值之差。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import AccumBounds\n",
    "AccumBounds(1, 3).delta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "intersection 交叉(other 其他)\n",
    "Returns the intersection of ‘self’ and ‘other’. Here other can be an instance of FiniteSet or AccumulationBounds.\n",
    "\n",
    "返回“自我”和“他人”的交集。在这里“他人”可以是“有限元素集”或“累积边界”的实例。\n",
    "\n",
    "Parameters 参数\n",
    "other: AccumulationBounds\n",
    "\n",
    "其他: 累积边界\n",
    "\n",
    "Another AccumulationBounds object with which the intersection has to be computed.\n",
    "\n",
    "必须用来计算交集的另一个累积边界对象。\n",
    "\n",
    "Returns 报税表\n",
    "AccumulationBounds\n",
    "\n",
    "累积上限\n",
    "\n",
    "Intersection of ‘self’ and ‘other’.\n",
    "\n",
    "自我和他人的交集。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import AccumBounds, FiniteSet\n",
    "AccumBounds(1, 3).intersection(AccumBounds(2, 4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "AccumBounds(1, 3).intersection(AccumBounds(4, 6))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "AccumBounds(1, 4).intersection(FiniteSet(1, 2, 5))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "property 财产 max 麦克斯\n",
    "Returns the maximum possible value attained by AccumulationBounds object.\n",
    "\n",
    "返回累积边界对象获得的最大可能值。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import AccumBounds\n",
    "AccumBounds(1, 3).max"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "property 财产 mid 中\n",
    "Returns the mean of maximum possible value attained by AccumulationBounds object and minimum possible value attained by AccumulationBounds object.\n",
    "\n",
    "返回累积边界对象获得的最大可能值的平均值和累积边界对象获得的最小可能值。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import AccumBounds\n",
    "AccumBounds(1, 3).mid"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "property 财产 min 分钟\n",
    "Returns the minimum possible value attained by AccumulationBounds object.\n",
    "\n",
    "返回累积边界对象获得的最小可能值。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import AccumBounds\n",
    "AccumBounds(1, 3).min"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.util. 症状，结石，尿毒症continuous_domain 连续 _ 畴(f, symbol 符号, domain 领域)\n",
    "Returns the intervals in the given domain for which the function is continuous. This method is limited by the ability to determine the various singularities and discontinuities of the given function.\n",
    "\n",
    "返回给定域中函数连续的时间间隔。这种方法是有限的能力，以确定各种奇点和不连续的给定函数。\n",
    "\n",
    "Parameters 参数\n",
    "f : Expr\n",
    "\n",
    "F: Expr\n",
    "\n",
    "The concerned function.\n",
    "\n",
    "有关职能。\n",
    "\n",
    "symbol : Symbol\n",
    "\n",
    "符号: 符号\n",
    "\n",
    "The variable for which the intervals are to be determined.\n",
    "\n",
    "要确定其间隔的变量。\n",
    "\n",
    "domain : Interval\n",
    "\n",
    "域名: 间隔\n",
    "\n",
    "The domain over which the continuity of the symbol has to be checked.\n",
    "\n",
    "必须检查符号连续性的域。\n",
    "\n",
    "Returns 报税表\n",
    "Interval\n",
    "\n",
    "时间段\n",
    "\n",
    "Union of all intervals where the function is continuous.\n",
    "\n",
    "函数连续的所有区间的并。\n",
    "\n",
    "Raises 加注\n",
    "NotImplementedError\n",
    "\n",
    "没有时间限制\n",
    "\n",
    "If the method to determine continuity of such a function has not yet been developed.\n",
    "\n",
    "如果确定这种函数连续性的方法还没有发展。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import Symbol, S, tan, log, pi, sqrt\n",
    "from sympy.sets import Interval\n",
    "from sympy.calculus.util import continuous_domain\n",
    "x = Symbol('x')\n",
    "continuous_domain(1/x, x, S.Reals)\n",
    "Union(Interval.open(-oo, 0), Interval.open(0, oo))\n",
    "Union(Interval.Ropen(0, pi/2), Interval.Lopen(pi/2, pi))\n",
    "continuous_domain(sqrt(x - 2), x, Interval(-5, 5))\n",
    "continuous_domain(log(2*x - 1), x, S.Reals)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.util. 症状，结石，尿毒症function_range 函数范围(f, symbol 符号, domain 领域)\n",
    "Finds the range of a function in a given domain. This method is limited by the ability to determine the singularities and determine limits.\n",
    "\n",
    "在给定域中查找函数的范围。这种方法是有限的能力，以确定奇异性和确定极限。\n",
    "\n",
    "Parameters 参数\n",
    "f : Expr\n",
    "\n",
    "F: Expr\n",
    "\n",
    "The concerned function.\n",
    "\n",
    "有关职能。\n",
    "\n",
    "symbol : Symbol\n",
    "\n",
    "符号: 符号\n",
    "\n",
    "The variable for which the range of function is to be determined.\n",
    "\n",
    "要确定函数范围的变量。\n",
    "\n",
    "domain : Interval\n",
    "\n",
    "域名: 间隔\n",
    "\n",
    "The domain under which the range of the function has to be found.\n",
    "\n",
    "必须找到函数范围的域。\n",
    "\n",
    "Returns 报税表\n",
    "Interval\n",
    "\n",
    "时间段\n",
    "\n",
    "Union of all ranges for all intervals under domain where function is continuous.\n",
    "\n",
    "函数为连续的域下所有区间的所有范围的并。\n",
    "\n",
    "Raises 加注\n",
    "NotImplementedError\n",
    "\n",
    "没有时间限制\n",
    "\n",
    "If any of the intervals, in the given domain, for which function is continuous are not finite or real, OR if the critical points of the function on the domain can’t be found.\n",
    "\n",
    "如果在给定的区域中，函数是连续的任何区间不是有限的或实的，或者如果在区域上函数的临界点不能找到。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import Symbol, S, exp, log, pi, sqrt, sin, tan\n",
    "from sympy.sets import Interval\n",
    "from sympy.calculus.util import function_range\n",
    "x = Symbol('x')\n",
    "function_range(sin(x), x, Interval(0, 2*pi))\n",
    "function_range(tan(x), x, Interval(-pi/2, pi/2))\n",
    "function_range(1/x, x, S.Reals)\n",
    "Union(Interval.open(-oo, 0), Interval.open(0, oo))\n",
    "function_range(exp(x), x, S.Reals)\n",
    "function_range(log(x), x, S.Reals)\n",
    "function_range(sqrt(x), x , Interval(-5, 9))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.util. 症状，结石，尿毒症is_convex 是凸面的(f, *syms 同“ syms”, domain=Reals域 = Reals)\n",
    "Determines the convexity of the function passed in the argument.\n",
    "\n",
    "确定在参数中传递的函数的凸度。\n",
    "\n",
    "Parameters 参数\n",
    "f : Expr\n",
    "\n",
    "F: Expr\n",
    "\n",
    "The concerned function.\n",
    "\n",
    "有关职能。\n",
    "\n",
    "syms : Tuple of symbols\n",
    "\n",
    "Syms: 符号的元组\n",
    "\n",
    "The variables with respect to which the convexity is to be determined.\n",
    "\n",
    "确定凸度的变量。\n",
    "\n",
    "domain : Interval, optional\n",
    "\n",
    "域: 间隔，可选\n",
    "\n",
    "The domain over which the convexity of the function has to be checked. If unspecified, S.Reals will be the default domain.\n",
    "\n",
    "必须检查函数凸性的区域。如果未指定，S.Reals 将是默认域。\n",
    "\n",
    "Returns 报税表\n",
    "Boolean\n",
    "\n",
    "布尔\n",
    "\n",
    "The method returns 𝑇𝑟𝑢𝑒 if the function is convex otherwise it returns 𝐹𝑎𝑙𝑠𝑒.\n",
    "\n",
    "该方法返回 True\n",
    "没错\n",
    "如果函数是凸的，否则返回\n",
    "错\n",
    "错\n",
    ".\n",
    "\n",
    "Raises 加注\n",
    "NotImplementedError\n",
    "\n",
    "没有时间限制\n",
    "\n",
    "The check for the convexity of multivariate functions is not implemented yet.\n",
    "\n",
    "多元函数凸性的检验尚未实现。\n",
    "\n",
    "Notes\n",
    "\n",
    "注释\n",
    "\n",
    "To determine concavity of a function pass −𝑓 as the concerned function. To determine logarithmic convexity of a function pass log(f) as concerned function. To determine logartihmic concavity of a function pass -log(f) as concerned function.\n",
    "\n",
    "确定函数 pass-f 的凹性\n",
    "- f\n",
    "作为有关的职能。确定函数通过对数(f)的对数凸性作为有关函数。确定函数 pass-log (f)作为有关函数的逻辑凹度。\n",
    "\n",
    "Currently, convexity check of multivariate functions is not handled.\n",
    "\n",
    "目前，多元函数的凸性检验还没有得到处理。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import symbols, exp, oo, Interval\n",
    "from sympy.calculus.util import is_convex\n",
    "x = symbols('x')\n",
    "is_convex(exp(x), x)\n",
    "True\n",
    "is_convex(x**3, x, domain = Interval(-1, oo))\n",
    "False"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "References\n",
    "\n",
    "参考资料\n",
    "\n",
    "R31\n",
    "https://en.wikipedia.org/wiki/Convex_function\n",
    "\n",
    "R32\n",
    "http://www.ifp.illinois.edu/~angelia/L3_convfunc.pdf\n",
    "\n",
    "R33\n",
    "https://en.wikipedia.org/wiki/Logarithmically_convex_function\n",
    "\n",
    "R34\n",
    "https://en.wikipedia.org/wiki/Logarithmically_concave_function\n",
    "\n",
    "R35\n",
    "https://en.wikipedia.org/wiki/Concave_function\n",
    "\n",
    "sympy.calculus.util. 症状，结石，尿毒症lcim(numbers 数字)\n",
    "Returns the least common integral multiple of a list of numbers.\n",
    "\n",
    "返回数列表的最小公共整数倍。\n",
    "\n",
    "The numbers can be rational or irrational or a mixture of both. 𝑁𝑜𝑛𝑒 is returned for incommensurable numbers.\n",
    "\n",
    "这些数字可以是理性的，也可以是非理性的，或者两者兼而有之。没有一个数字是不可通约的。\n",
    "\n",
    "Parameters 参数\n",
    "numbers : list\n",
    "\n",
    "号码: 列表\n",
    "\n",
    "Numbers (rational and/or irrational) for which lcim is to be found.\n",
    "\n",
    "找到 lcim 的数字(有理数和/或无理数)。\n",
    "\n",
    "Returns 报税表\n",
    "number\n",
    "\n",
    "数字\n",
    "\n",
    "lcim if it exists, otherwise 𝑁𝑜𝑛𝑒 for incommensurable numbers.\n",
    "\n",
    "如果它存在，则为 lcim，否则为零\n",
    "没有\n",
    "不可通约的数字。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import S, pi\n",
    "from sympy.calculus.util import lcim\n",
    "lcim([S(1)/2, S(3)/4, S(5)/6])\n",
    "15/2\n",
    "lcim([2*pi, 3*pi, pi, pi/2])\n",
    "6*pi\n",
    "lcim([S(1), 2*pi])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.util. 症状，结石，尿毒症maximum 最大(f, symbol 符号, domain=Reals域 = Reals)\n",
    "Returns the maximum value of a function in the given domain.\n",
    "\n",
    "返回给定域中函数的最大值。\n",
    "\n",
    "Parameters 参数\n",
    "f : Expr\n",
    "\n",
    "F: Expr\n",
    "\n",
    "The concerned function.\n",
    "\n",
    "有关职能。\n",
    "\n",
    "symbol : Symbol\n",
    "\n",
    "符号: 符号\n",
    "\n",
    "The variable for maximum value needs to be determined.\n",
    "\n",
    "需要确定最大值的变量。\n",
    "\n",
    "domain : Interval\n",
    "\n",
    "域名: 间隔\n",
    "\n",
    "The domain over which the maximum have to be checked. If unspecified, then Global maximum is returned.\n",
    "\n",
    "必须检查最大值的域。如果未指定，则返回全局最大值。\n",
    "\n",
    "Returns 报税表\n",
    "number\n",
    "\n",
    "数字\n",
    "\n",
    "Maximum value of the function in given domain.\n",
    "\n",
    "函数在给定区域上的最大值。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import Symbol, S, sin, cos, pi, maximum\n",
    "from sympy.sets import Interval\n",
    "x = Symbol('x')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "f = -x**2 + 2*x + 5\n",
    "maximum(f, x, S.Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "maximum(sin(x), x, Interval(-pi, pi/4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "maximum(sin(x)*cos(x), x)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.util. 症状，结石，尿毒症minimum 最小(f, symbol 符号, domain=Reals域 = Reals)\n",
    "Returns the minimum value of a function in the given domain.\n",
    "\n",
    "返回给定域中函数的最小值。\n",
    "\n",
    "Parameters 参数\n",
    "f : Expr\n",
    "\n",
    "F: Expr\n",
    "\n",
    "The concerned function.\n",
    "\n",
    "有关职能。\n",
    "\n",
    "symbol : Symbol\n",
    "\n",
    "符号: 符号\n",
    "\n",
    "The variable for minimum value needs to be determined.\n",
    "\n",
    "需要确定最小值的变量。\n",
    "\n",
    "domain : Interval\n",
    "\n",
    "域名: 间隔\n",
    "\n",
    "The domain over which the minimum have to be checked. If unspecified, then Global minimum is returned.\n",
    "\n",
    "必须检查其最小值的域。如果未指定，则返回全局最小值。\n",
    "\n",
    "Returns 报税表\n",
    "number\n",
    "\n",
    "数字\n",
    "\n",
    "Minimum value of the function in the given domain.\n",
    "\n",
    "给定域中函数的最小值。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import Symbol, S, sin, cos, minimum\n",
    "from sympy.sets import Interval\n",
    "x = Symbol('x')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "f = x**2 + 2*x + 5\n",
    "minimum(f, x, S.Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "minimum(sin(x), x, Interval(2, 3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "minimum(sin(x)*cos(x), x)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.util. 症状，结石，尿毒症not_empty_in 不是空的(finset_intersection 交叉点, *syms 同“ syms”)\n",
    "Finds the domain of the functions in 𝑓𝑖𝑛𝑖𝑡𝑒𝑠𝑒𝑡 in which the 𝑓𝑖𝑛𝑖𝑡𝑒𝑠𝑒𝑡 is not-empty\n",
    "\n",
    "在 finit 中查找函数的域\n",
    "E\n",
    "没错\n",
    "Et\n",
    "有限元素\n",
    "在其中\n",
    "终止\n",
    "E\n",
    "没错\n",
    "Et\n",
    "有限元素\n",
    "不是空的\n",
    "\n",
    "Parameters 参数\n",
    "finset_intersection : The unevaluated intersection of FiniteSet containing\n",
    "\n",
    "的未求值的交集\n",
    "\n",
    "real-valued functions with Union of Sets\n",
    "\n",
    "集合并的实值函数\n",
    "\n",
    "syms : Tuple of symbols\n",
    "\n",
    "Syms: 符号的元组\n",
    "\n",
    "Symbol for which domain is to be found\n",
    "\n",
    "要为其找到域的符号\n",
    "\n",
    "Raises 加注\n",
    "NotImplementedError\n",
    "\n",
    "没有时间限制\n",
    "\n",
    "The algorithms to find the non-emptiness of the given FiniteSet are not yet implemented.\n",
    "\n",
    "求解给定有限元网络非空性的算法尚未实现。\n",
    "\n",
    "ValueError\n",
    "\n",
    "值错误\n",
    "\n",
    "The input is not valid.\n",
    "\n",
    "输入无效。\n",
    "\n",
    "RuntimeError\n",
    "\n",
    "It is a bug, please report it to the github issue tracker (https://github.com/sympy/sympy/issues).\n",
    "\n",
    "这是一个 bug，请将它报告给 github 问题追踪器( https://github.com/sympy/sympy/issues )。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import FiniteSet, Interval, not_empty_in, oo\n",
    "from sympy.abc import x\n",
    "not_empty_in(FiniteSet(x/2).intersect(Interval(0, 1)), x)\n",
    "not_empty_in(FiniteSet(x, x**2).intersect(Interval(1, 2)), x)\n",
    "not_empty_in(FiniteSet(x**2/(x + 2)).intersect(Interval(1, oo)), x)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.util. 症状，结石，尿毒症periodicity 周期性(f, symbol 符号, check=False检查 = False)\n",
    "Tests the given function for periodicity in the given symbol.\n",
    "\n",
    "测试给定函数在给定符号中的周期性。\n",
    "\n",
    "Parameters 参数\n",
    "f : Expr.\n",
    "\n",
    "F: Expr.\n",
    "\n",
    "The concerned function.\n",
    "\n",
    "有关职能。\n",
    "\n",
    "symbol : Symbol\n",
    "\n",
    "符号: 符号\n",
    "\n",
    "The variable for which the period is to be determined.\n",
    "\n",
    "要确定周期的变量。\n",
    "\n",
    "check : Boolean, optional\n",
    "\n",
    "检查: 布尔值，可选\n",
    "\n",
    "The flag to verify whether the value being returned is a period or not.\n",
    "\n",
    "用于验证要返回的值是否为句点的标志。\n",
    "\n",
    "Returns 报税表\n",
    "period\n",
    "\n",
    "时期\n",
    "\n",
    "The period of the function is returned. 𝑁𝑜𝑛𝑒 is returned when the function is aperiodic or has a complex period. The value of 0 is returned as the period of a constant function.\n",
    "\n",
    "返回函数的周期。无\n",
    "没有\n",
    "当函数是非周期性的或具有复杂周期时返回\n",
    "0\n",
    "0\n",
    "作为常数函数的周期返回。\n",
    "\n",
    "Raises 加注\n",
    "NotImplementedError\n",
    "\n",
    "没有时间限制\n",
    "\n",
    "The value of the period computed cannot be verified.\n",
    "\n",
    "无法验证计算的周期的值。\n",
    "\n",
    "Notes\n",
    "\n",
    "注释\n",
    "\n",
    "Currently, we do not support functions with a complex period. The period of functions having complex periodic values such as 𝑒𝑥𝑝, 𝑠𝑖𝑛ℎ is evaluated to 𝑁𝑜𝑛𝑒.\n",
    "\n",
    "目前，我们不支持复杂周期的函数。具有复杂周期值的函数的周期，如 exp\n",
    "经验\n",
    ",\n",
    "没错\n",
    "没错\n",
    "被评估为\n",
    "没有\n",
    "没有\n",
    ".\n",
    "\n",
    "The value returned might not be the “fundamental” period of the given function i.e. it may not be the smallest periodic value of the function.\n",
    "\n",
    "返回的值可能不是给定函数的“基本”周期，也就是说，它可能不是函数的最小周期值。\n",
    "\n",
    "The verification of the period through the 𝑐ℎ𝑒𝑐𝑘 flag is not reliable due to internal simplification of the given expression. Hence, it is set to 𝐹𝑎𝑙𝑠𝑒 by default.\n",
    "\n",
    "通过支票核实期限\n",
    "检查\n",
    "由于给定表达式的内部简化，标志不可靠。因此，将其设置为\n",
    "错\n",
    "错\n",
    "默认。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import Symbol, sin, cos, tan, exp\n",
    "from sympy.calculus.util import periodicity\n",
    "x = Symbol('x')\n",
    "f = sin(x) + sin(2*x) + sin(3*x)\n",
    "periodicity(f, x)\n",
    "2*pi\n",
    "periodicity(sin(x)*cos(x), x)\n",
    "pi\n",
    "periodicity(exp(tan(2*x) - 1), x)\n",
    "pi/2\n",
    "periodicity(sin(4*x)**cos(2*x), x)\n",
    "pi\n",
    "periodicity(exp(x), x)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sympy.calculus.util. 症状，结石，尿毒症stationary_points 静止点(f, symbol 符号, domain=Reals域 = Reals)\n",
    "Returns the stationary points of a function (where derivative of the function is 0) in the given domain.\n",
    "\n",
    "返回给定域中函数的稳定点(其中函数的导数为0)。\n",
    "\n",
    "Parameters 参数\n",
    "f : Expr\n",
    "\n",
    "F: Expr\n",
    "\n",
    "The concerned function.\n",
    "\n",
    "有关职能。\n",
    "\n",
    "symbol : Symbol\n",
    "\n",
    "符号: 符号\n",
    "\n",
    "The variable for which the stationary points are to be determined.\n",
    "\n",
    "要确定静止点的变量。\n",
    "\n",
    "domain : Interval\n",
    "\n",
    "域名: 间隔\n",
    "\n",
    "The domain over which the stationary points have to be checked. If unspecified, S.Reals will be the default domain.\n",
    "\n",
    "必须检查静止点的域。如果未指定，S.Reals 将是默认域。\n",
    "\n",
    "Returns 报税表\n",
    "Set\n",
    "\n",
    "预备\n",
    "\n",
    "A set of stationary points for the function. If there are no stationary point, an EmptySet is returned.\n",
    "\n",
    "函数的一组固定点，如果没有驻点，返回一个 EmptySet。\n",
    "\n",
    "Examples\n",
    "\n",
    "例子"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import Symbol, S, sin, pi, pprint, stationary_points\n",
    "from sympy.sets import Interval\n",
    "x = Symbol('x')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "stationary_points(1/x, x, S.Reals)\n",
    "EmptySet"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "pprint(stationary_points(sin(x), x), use_unicode=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "stationary_points(sin(x),x, Interval(0, 4*pi))"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "40d3a090f54c6569ab1632332b64b2c03c39dcf918b08424e98f38b5ae0af88f"
  },
  "kernelspec": {
   "display_name": "Python 3.8.8 ('base')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
